package com.matchmealpha;

import java.util.ArrayList;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Scanner;

import android.graphics.Bitmap;
import android.util.Log;

public class Post implements Comparable {
	
	private int postID;
	private String userID1; // requestor
	private String userID2; // requestee
	private int[] pic;
	private Bitmap image;
	private String location1;
	private String location2;
	private String status;
	private GregorianCalendar time1;
	private GregorianCalendar time2;
	private String description1;
	private String description2;
	private ArrayList<String> tagList;
	private ArrayList<String> likeList;
	private ArrayList<Comment> commentList;
	
	public Post()
	{
		userID1 = "";
		userID2 = "";
		location1 = "";
		location2 = "";
		//setTime1("");
		//setTime2("");
		setDescription1("");
		setDescription2("");
		setTagList(new ArrayList<String>());
		setLikeList(new ArrayList<String>());
		setCommentList(new ArrayList<Comment>());
	}
	
	public int getPostID() {
		return postID;
	}
	public void setPostID(int postID) {
		this.postID = postID;
	}
//	public void setImage(Bitmap image) {
//		this.image = image;
//	}
//	public Bitmap getImage() {
//		return image;
//	}
	public String getUserID1() {
		return userID1;
	}
	public void setUserID1(String userID1) {
		this.userID1 = userID1;
	}
	public String getUserID2() {
		return userID2;
	}
	public void setUserID2(String userID2) {
		this.userID2 = userID2;
	}
	public String getLocation1() {
		return location1;
	}
	public void setLocation1(String location1) {
		this.location1 = location1;
	}
	public String getLocation2() {
		return location2;
	}
	public void setLocation2(String location2) {
		this.location2 = location2;
	}

	public void setTime1(String time1) {
		Log.d("POST: TIME", time1);
		Scanner in = new Scanner(time1).useDelimiter("-");
		GregorianCalendar d = new GregorianCalendar(in.nextInt(), in.nextInt(), in.nextInt(), in.nextInt(), in.nextInt(), in.nextInt()); 
		this.time1 = d;
	}

	public String getTime1() {
		String s = "";
		s = time1.get(GregorianCalendar.HOUR) + ":" + time1.get(GregorianCalendar.MINUTE) + " " + time1.get(GregorianCalendar.AM_PM) + " " + time1.get(GregorianCalendar.DAY_OF_WEEK) + " " + time1.get(GregorianCalendar.MONTH) + " " + time1.get(GregorianCalendar.DAY_OF_MONTH) + " " 
	+ time1.get(GregorianCalendar.YEAR);
		
		return s;
	}

	public void setTime2(String time2) {
		Log.d("POST: TIME2", time2);
		Scanner in = new Scanner(time2).useDelimiter("-");
		GregorianCalendar d = new GregorianCalendar(in.nextInt(), in.nextInt(), in.nextInt(), in.nextInt(), in.nextInt(), in.nextInt()); 

		Log.d("TIME: TIME2 SAVED", d.toString());
		this.time2 = d;
	}

	public String getTime2() {
		String s = "";
			s = time2.get(GregorianCalendar.HOUR) + ":" + time2.get(GregorianCalendar.MINUTE) + " " + time2.get(GregorianCalendar.AM_PM) + " " + time2.get(GregorianCalendar.DAY_OF_WEEK) + " " + time2.get(GregorianCalendar.MONTH) + " " + time2.get(GregorianCalendar.DAY_OF_MONTH) + " " 
		+ time2.get(GregorianCalendar.YEAR);
			
			return s;
	}

	public void setDescription1(String description1) {
		this.description1 = description1;
	}

	public String getDescription1() {
		return description1;
	}

	public void setDescription2(String description2) {
		this.description2 = description2;
	}

	public String getDescription2() {
		return description2;
	}

	public void setTagList(ArrayList<String> tagList) {
		this.tagList = tagList;
	}

	public ArrayList<String> getTagList() {
		return tagList;
	}

	public void setLikeList(ArrayList<String> likeList) {
		this.likeList = likeList;
	}

	public ArrayList<String> getLikeList() {
		return likeList;
	}

	public void setCommentList(ArrayList<Comment> commentList) {
		this.commentList = commentList;
	}

	public ArrayList<Comment> getCommentList() {
		return commentList;
	}

	public void setPicID(int[] picID) {
		this.pic = picID;
	}

	public int[] getPicID() {
		return pic;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getStatus() {
		return status;
	}
	
	public GregorianCalendar getDate() {
		return time2;
	}

	@Override
	public int compareTo(Object arg0) {
		// TODO Auto-generated method stub
		Post p = (Post)arg0;
		
		return time2.compareTo(p.time2);
	}

	public void setBitMapImage(Bitmap image) {
		this.image = image;
	}

	public Bitmap getBitMapImage() {
		return image;
	}
	
	

}
